//package com.zj.weather.bgviews;
//
//import android.content.Context;
//import android.graphics.Canvas;
//import android.graphics.drawable.GradientDrawable;
//
//import java.util.ArrayList;
//
//import com.zj.weather.base.BaseWeatherBgView;
//import com.zj.weather.bgviews.RainDrawer.RainDrawable;
//import com.zj.weather.bgviews.RainDrawer.RainHolder;
//import com.zj.weather.bgviews.SnowDrawer.SnowHolder;
//
//import static com.zj.weather.utils.RandomUtils.getRandom;
//
///**
// * 雨夹雪
// */
//@SuppressWarnings("unused")
//public class RainAndSnowDrawer extends BaseWeatherBgView {
//    private GradientDrawable snowDrawable;
//    private RainDrawable rainDrawable;
//    private ArrayList<SnowHolder> snowHolders = new ArrayList<>();
//    private ArrayList<RainHolder> rainHolders = new ArrayList<>();
//
//    private static final int SNOW_COUNT = 15;
//    private static final int RAIN_COUNT = 30;
//    private static final float MIN_SIZE = 6f;
//    private static final float MAX_SIZE = 14f;
//
//    public RainAndSnowDrawer(Context context, int key) {
//        super(context, key);
//    }
//
//    @Override
//    protected void initValues(Context context) {
//        snowDrawable = new GradientDrawable(GradientDrawable.Orientation.BL_TR, new int[]{0xa6ffffff, 0x33ffffff});
//        snowDrawable.setShape(GradientDrawable.OVAL);
//        snowDrawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
//        rainDrawable = new RainDrawable();
//    }
//
//    @Override
//    protected void drawWeather(Canvas canvas, float alpha) {
//        for (SnowHolder holder : snowHolders) {
//            holder.updateRandom(snowDrawable, alpha);
//            snowDrawable.draw(canvas);
//        }
//        for (RainHolder holder : rainHolders) {
//            holder.updateRandom(rainDrawable, alpha);
//            rainDrawable.draw(canvas);
//        }
//    }
//
//    @Override
//    public void setSize(int width, int height) {
//        super.setSize(width, height);
//        if (this.snowHolders.size() == 0) {
//            final float minSize = dp2px(MIN_SIZE);
//            final float maxSize = dp2px(MAX_SIZE);
//            final float speed = dp2px(200);
//            for (int i = 0; i < SNOW_COUNT; i++) {
//                final float size = getRandom(minSize, maxSize);
//                SnowHolder holder = new SnowHolder(getRandom(0, width), size, height, speed);
//                snowHolders.add(holder);
//            }
//        }
//        if (this.rainHolders.size() == 0) {
//            final float rainWidth = dp2px(2);
//            final float minRainHeight = dp2px(8);
//            final float maxRainHeight = dp2px(14);
//            final float speed = dp2px(360);
//            for (int i = 0; i < RAIN_COUNT; i++) {
//                float x = getRandom(0f, width);
//                RainHolder holder = new RainHolder(x, height);
//                rainHolders.add(holder);
//            }
//        }
//    }
//}
